package com.bootdo.common.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 *
 * @description:放行静态资源（自定义静态资源默认存储位置）
 * @param
 * @return:
 *
 * @author:作者:YF
 * @time:日期:2021/5/10  时间:13:50
 */
@Configuration
public class FanMvcConfig extends WebMvcConfigurerAdapter {
    @Value("${upload.AttachedResume}")
    private String attachedResume;

    @Value("${upload.PhotoAlbum}")
    private String photoAlbum;

    @Value("${upload.bannerPhoto}")
    private String bannerPhoto;

    @Value("${upload.titlePhoto}")
    private String titlePhoto;

    @Value("${upload.Avatar}")
    private String avatar;

    @Value("${upload.IdentitycardFront}")
    private String identitycardFront;

    @Value("${upload.IdentitycardContrary}")
    private String identitycardContrary;

    @Value("${upload.IdentitycardHand}")
    private String identitycardHand;

    @Value("${upload.BusinessLicense}")
    private String businessLicense;

    @Value("${upload.Companylog}")
    private String Companylog;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**","/upload/**").
                addResourceLocations("classpath:/static/").
                addResourceLocations("file:"+avatar).
                addResourceLocations("file:"+bannerPhoto).
                addResourceLocations("file:"+titlePhoto).
                addResourceLocations("file:"+attachedResume).
                addResourceLocations("file:"+photoAlbum).
                addResourceLocations("file:"+identitycardFront).
                addResourceLocations("file:"+identitycardContrary).
                addResourceLocations("file:"+Companylog).
                addResourceLocations("file:"+identitycardHand).
                addResourceLocations("file:"+businessLicense);;
        super.addResourceHandlers(registry);
    }
}
